package com.xoa.controller.hr;


import com.xoa.util.CookiesUtil;
import com.xoa.util.common.session.SessionUtils;
import com.xoa.util.dataSource.ContextHolder;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;

/**
 * Created by 韩东堂 on 2017/7/12.
 * 人士管理页面映射类
 */
@Controller
@RequestMapping("/hr/page")
public class HrPageController {
    private Logger loger=Logger.getLogger(HrPageController.class);

    @RequestMapping("/assessment")
    public String assessment(HttpServletRequest request){
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/hr/assessment";
    }
    @RequestMapping("/retiree")
    public String retiree(HttpServletRequest request){
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/hr/retiree";
    }

    @RequestMapping("/*")
    public String manageMail(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/hr/hrindex";
    }

    @RequestMapping("/hrOnJop")
    public String  selectPersonnelFile(HttpServletRequest request){
        return "app/hr/hr_onJop";
    }

    @RequestMapping("/hrOnFind")
    public  String findPersonFile(HttpServletRequest request){
        return "app/hr/hr_onFind";
    }

    @RequestMapping("/hrLeaveJop")
    public String leavePerson(HttpServletRequest request){
        return "app/hr/hr_leaveJop";
    }

    @RequestMapping("/hrLeaveFind")
    public String leavaFindPerson(HttpServletRequest request){
        return "app/hr/hr_leaveFind";
    }

    @RequestMapping("/hrContRight")
    public String contRightLeavePerson(HttpServletRequest request){
        return "app/hr/hr_contRight";
    }

    @RequestMapping("/contractDueQuery")
    public String contractDueQuery(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/hr/contractDueQuery";
    }

    @RequestMapping("/contractIndex")
    public String contractIndex(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/hr/contractIndex";
    }

    @RequestMapping("/contractInOut")
    public String contractInOut(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/hr/contractInOut";
    }

    @RequestMapping("/contractNew")
    public String contractNew(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/hr/contractNew";
    }

    @RequestMapping("/contractQuery")
    public String contractQuery(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/hr/contractQuery";
    }

    @RequestMapping("/contractUp")
    public String contractUp(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/hr/contractUp";
    }
    @RequestMapping("/contractStraff")
    public String contractStraff(HttpServletRequest request) {
        return "app/hr/contractStraff";
    }
    @RequestMapping("/noContract")
    public String noContract(HttpServletRequest request) {
        return "app/hr/contractStraff";
    }
    @RequestMapping("/contractDetail")
    public String contractDetail(HttpServletRequest request) {
        return "app/hr/contractDetail";
    }


    //骆鹏添加
    @RequestMapping("/personnelInformation")
    public String personnelInformation(){
        return "app/hr/personnelInformation";
    }

    @RequestMapping("/hrImportInfo")
    public String hrImportInfo(){
        return "app/hr/hrImportInfo";
    }

    @RequestMapping("/contractImport")
    public String getcontractImportPage(){
       return "/app/hr/contractImport";
    }
}
